#include<bits/stdc++.h>
#define int long long 
using namespace std;
int getans(int x,int len) {
//	cout<<"Just Do It.\n";
//	cout<<x<<" "<<len<<"\n";
	int ans = len;
	while(x) {
		if(x&&len < 1)return INT_MAX;
		ans += (int)x/len;
		x -= (int)x/len*len;
		len = min(len-2,x-(len%2 != x%2));
	} return ans+1;
}
signed main()
{
	freopen("tree.in","r",stdin);
	freopen("tree.out","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t;
	cin>>t;
	while(t --) {
		int x,ans,len;
		cin>>x;
		if(x == 0) {
			cout<<"2\n";
			continue;
		}
		if(x%2 == 1) {
			len = (int)sqrt(x);
			if(len%2 == 0)
				ans = min(getans(x,len-1),getans(x,len+1));
			else ans = getans(x,len);
		} else {
			len = (int)sqrt(x);
			ans = min({getans(x,len-1),getans(x,len),getans(x,len+1)});
		} cout<<max(2ll,ans)<<"\n";
	}
	return 0;
 } 
